/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gob.inamhi.entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dhinojosa
 */
@Entity
@Table(name = "cain", schema="administrative")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Cain.findAll", query = "SELECT c FROM Cain c"),
    @NamedQuery(name = "Cain.findByCainId", query = "SELECT c FROM Cain c WHERE c.cainId = :cainId"),
    @NamedQuery(name = "Cain.findByCainfein", query = "SELECT c FROM Cain c WHERE c.cainfein = :cainfein"),
    @NamedQuery(name = "Cain.findByCainhoin", query = "SELECT c FROM Cain c WHERE c.cainhoin = :cainhoin"),
    @NamedQuery(name = "Cain.findByCainfefi", query = "SELECT c FROM Cain c WHERE c.cainfefi = :cainfefi"),
    @NamedQuery(name = "Cain.findByCainhofi", query = "SELECT c FROM Cain c WHERE c.cainhofi = :cainhofi"),
    @NamedQuery(name = "Cain.findByCaindesc", query = "SELECT c FROM Cain c WHERE c.caindesc = :caindesc"),
    @NamedQuery(name = "Cain.findByCainesta", query = "SELECT c FROM Cain c WHERE c.cainesta = :cainesta"),
    @NamedQuery(name = "Cain.findByCaintacom", query = "SELECT c FROM Cain c WHERE c.caintacom = :caintacom"),
    @NamedQuery(name = "Cain.findByCainobse", query = "SELECT c FROM Cain c WHERE c.cainobse = :cainobse"),
    @NamedQuery(name = "Cain.findByCainasuge", query = "SELECT c FROM Cain c WHERE c.cainasuge = :cainasuge"),
    @NamedQuery(name = "Cain.findByCainarch", query = "SELECT c FROM Cain c WHERE c.cainarch = :cainarch"),
    @NamedQuery(name = "Cain.findByCainrespo", query = "SELECT c FROM Cain c WHERE c.cainrespo = :cainrespo"),
    @NamedQuery(name = "Cain.findByCainuing", query = "SELECT c FROM Cain c WHERE c.cainuing = :cainuing"),
    @NamedQuery(name = "Cain.findByCainfing", query = "SELECT c FROM Cain c WHERE c.cainfing = :cainfing"),
    @NamedQuery(name = "Cain.findByCainumod", query = "SELECT c FROM Cain c WHERE c.cainumod = :cainumod"),
    @NamedQuery(name = "Cain.findByCainfmod", query = "SELECT c FROM Cain c WHERE c.cainfmod = :cainfmod")})
public class Cain implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 35)
    @Column(name = "cain__id")
    private String cainId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cainfein")
    @Temporal(TemporalType.DATE)
    private Date cainfein;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cainhoin")
    @Temporal(TemporalType.TIME)
    private Date cainhoin;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cainfefi")
    @Temporal(TemporalType.DATE)
    private Date cainfefi;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cainhofi")
    @Temporal(TemporalType.TIME)
    private Date cainhofi;
    @Size(max = 2147483647)
    @Column(name = "caindesc")
    private String caindesc;
    @Size(max = 2147483647)
    @Column(name = "cainesta")
    private String cainesta;
    @Size(max = 2147483647)
    @Column(name = "caintacom")
    private String caintacom;
    @Size(max = 2147483647)
    @Column(name = "cainobse")
    private String cainobse;
    @Size(max = 2147483647)
    @Column(name = "cainasuge")
    private String cainasuge;
    @Size(max = 2147483647)
    @Column(name = "cainarch")
    private String cainarch;
    @Lob
    @Column(name = "cainimn")
    private byte[] cainimn;
    @Lob
    @Column(name = "cainims")
    private byte[] cainims;
    @Lob
    @Column(name = "cainime")
    private byte[] cainime;
    @Lob
    @Column(name = "cainimo")
    private byte[] cainimo;
    @Lob
    @Column(name = "cainimno")
    private byte[] cainimno;
    @Lob
    @Column(name = "cainimne")
    private byte[] cainimne;
    @Lob
    @Column(name = "cainimso")
    private byte[] cainimso;
    @Lob
    @Column(name = "cainimse")
    private byte[] cainimse;
    @Size(max = 2147483647)
    @Column(name = "cainrespo")
    private String cainrespo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "cainuing")
    private String cainuing;
    @Basic(optional = false)
    @NotNull
    @Column(name = "cainfing")
    @Temporal(TemporalType.TIMESTAMP)
    private Date cainfing;
    @Size(max = 20)
    @Column(name = "cainumod")
    private String cainumod;
    @Column(name = "cainfmod")
    @Temporal(TemporalType.TIMESTAMP)
    private Date cainfmod;
    @JoinColumn(name = "tiop__id", referencedColumnName = "tiop__id")
    @ManyToOne(optional = false)
    private Tiop tiopId;
    @JoinColumn(name = "esta__id", referencedColumnName = "esta__id")
    @ManyToOne(optional = false)
    private Esta estaId;
    @JoinColumn(name = "esma__id", referencedColumnName = "esma__id")
    @ManyToOne(optional = false)
    private Esma esmaId;
    @JoinColumn(name = "esge__id", referencedColumnName = "esge__id")
    @ManyToOne(optional = false)
    private Esge esgeId;
    @OneToMany(mappedBy = "cainId")
    private Collection<Cfges> cfgesCollection;

    public Cain() {
    }

    public Cain(String cainId) {
        this.cainId = cainId;
    }

    public Cain(String cainId, Date cainfein, Date cainhoin, Date cainfefi, Date cainhofi, String cainuing, Date cainfing) {
        this.cainId = cainId;
        this.cainfein = cainfein;
        this.cainhoin = cainhoin;
        this.cainfefi = cainfefi;
        this.cainhofi = cainhofi;
        this.cainuing = cainuing;
        this.cainfing = cainfing;
    }

    public String getCainId() {
        return cainId;
    }

    public void setCainId(String cainId) {
        this.cainId = cainId;
    }

    public Date getCainfein() {
        return cainfein;
    }

    public void setCainfein(Date cainfein) {
        this.cainfein = cainfein;
    }

    public Date getCainhoin() {
        return cainhoin;
    }

    public void setCainhoin(Date cainhoin) {
        this.cainhoin = cainhoin;
    }

    public Date getCainfefi() {
        return cainfefi;
    }

    public void setCainfefi(Date cainfefi) {
        this.cainfefi = cainfefi;
    }

    public Date getCainhofi() {
        return cainhofi;
    }

    public void setCainhofi(Date cainhofi) {
        this.cainhofi = cainhofi;
    }

    public String getCaindesc() {
        return caindesc;
    }

    public void setCaindesc(String caindesc) {
        this.caindesc = caindesc;
    }

    public String getCainesta() {
        return cainesta;
    }

    public void setCainesta(String cainesta) {
        this.cainesta = cainesta;
    }

    public String getCaintacom() {
        return caintacom;
    }

    public void setCaintacom(String caintacom) {
        this.caintacom = caintacom;
    }

    public String getCainobse() {
        return cainobse;
    }

    public void setCainobse(String cainobse) {
        this.cainobse = cainobse;
    }

    public String getCainasuge() {
        return cainasuge;
    }

    public void setCainasuge(String cainasuge) {
        this.cainasuge = cainasuge;
    }

    public String getCainarch() {
        return cainarch;
    }

    public void setCainarch(String cainarch) {
        this.cainarch = cainarch;
    }

    public byte[] getCainimn() {
        return cainimn;
    }

    public void setCainimn(byte[] cainimn) {
        this.cainimn = cainimn;
    }

    public byte[] getCainims() {
        return cainims;
    }

    public void setCainims(byte[] cainims) {
        this.cainims = cainims;
    }

    public byte[] getCainime() {
        return cainime;
    }

    public void setCainime(byte[] cainime) {
        this.cainime = cainime;
    }

    public byte[] getCainimo() {
        return cainimo;
    }

    public void setCainimo(byte[] cainimo) {
        this.cainimo = cainimo;
    }

    public byte[] getCainimno() {
        return cainimno;
    }

    public void setCainimno(byte[] cainimno) {
        this.cainimno = cainimno;
    }

    public byte[] getCainimne() {
        return cainimne;
    }

    public void setCainimne(byte[] cainimne) {
        this.cainimne = cainimne;
    }

    public byte[] getCainimso() {
        return cainimso;
    }

    public void setCainimso(byte[] cainimso) {
        this.cainimso = cainimso;
    }

    public byte[] getCainimse() {
        return cainimse;
    }

    public void setCainimse(byte[] cainimse) {
        this.cainimse = cainimse;
    }

    public String getCainrespo() {
        return cainrespo;
    }

    public void setCainrespo(String cainrespo) {
        this.cainrespo = cainrespo;
    }

    public String getCainuing() {
        return cainuing;
    }

    public void setCainuing(String cainuing) {
        this.cainuing = cainuing;
    }

    public Date getCainfing() {
        return cainfing;
    }

    public void setCainfing(Date cainfing) {
        this.cainfing = cainfing;
    }

    public String getCainumod() {
        return cainumod;
    }

    public void setCainumod(String cainumod) {
        this.cainumod = cainumod;
    }

    public Date getCainfmod() {
        return cainfmod;
    }

    public void setCainfmod(Date cainfmod) {
        this.cainfmod = cainfmod;
    }

    public Tiop getTiopId() {
        return tiopId;
    }

    public void setTiopId(Tiop tiopId) {
        this.tiopId = tiopId;
    }

    public Esta getEstaId() {
        return estaId;
    }

    public void setEstaId(Esta estaId) {
        this.estaId = estaId;
    }

    public Esma getEsmaId() {
        return esmaId;
    }

    public void setEsmaId(Esma esmaId) {
        this.esmaId = esmaId;
    }

    public Esge getEsgeId() {
        return esgeId;
    }

    public void setEsgeId(Esge esgeId) {
        this.esgeId = esgeId;
    }

    @XmlTransient
    public Collection<Cfges> getCfgesCollection() {
        return cfgesCollection;
    }

    public void setCfgesCollection(Collection<Cfges> cfgesCollection) {
        this.cfgesCollection = cfgesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cainId != null ? cainId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cain)) {
            return false;
        }
        Cain other = (Cain) object;
        if ((this.cainId == null && other.cainId != null) || (this.cainId != null && !this.cainId.equals(other.cainId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gob.inamhi.entidades.Cain[ cainId=" + cainId + " ]";
    }
    
}
